package consultan.vanke.com.widgets;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import consultan.vanke.com.R;

public class TabLayoutManager {
    public static final int[] mTabRes = new int[]{R.mipmap.home_nor, R.mipmap.shop_nor, R.mipmap.mine_nor};
    public static final int[] mTabRespressed = new int[]{R.mipmap.home_pres, R.mipmap.shop_pres, R.mipmap.mine_pres};
    public static final String[] mTabTitle = new String[]{"首页", "商城", "我的"};

    public static View getTabView(Context context, int position, int defaultposition) {
        View view = LayoutInflater.from(context).inflate(R.layout.main_tab_item, null);
        ImageView tabIcon = (ImageView) view.findViewById(R.id.tv_tab);
        TextView tabText = (TextView) view.findViewById(R.id.tv_text);
        tabText.setText(mTabTitle[position]);
        if (position == defaultposition) {
            tabIcon.setImageResource(TabLayoutManager.mTabRespressed[position]);
            tabText.setTextColor(context.getResources().getColor(R.color.color_687ADE));
        } else {
            tabIcon.setImageResource(TabLayoutManager.mTabRes[position]);
            tabText.setTextColor(context.getResources().getColor(R.color.color_C1C9D0));
        }
        return view;
    }
}
